<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hello world</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <input v-model="inputValue" type="text">
        <button v-on:click="handleBtnClick">提交</button>
        <ul>
            <li v-for="(item, index) in list">{{item}} <button v-on:click="delBtnClick(index)">删除</button></li>
        </ul>
    </div>
    <!--  基本TodeList   -->
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                list: [],
                inputValue: ''
            },
            methods: {
                handleBtnClick: function () {
                    this.list.push(this.inputValue);
                    this.inputValue = "";
                },
                delBtnClick: function (index) {
                    this.list.splice(index,1)
                }
            }
        })
    </script>
</body>
</html>